home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / util / conv / BFS_ToUpLow.lha / BFS_ToLowerClass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-04  |  3.0 KB  |  140 lines

  1. /****h* Beast/BFS_ToLowerClass.c [1.0] ********
  2. *
  3. *    NAME
  4. *      BFS_ToLowerClass --
  5. *
  6. *    COPYRIGHT
  7. *      Maverick Software Development
  8. *
  9. *    AUTHOR
  10. *      Jacco van Weert
  11. *
  12. *    CREATION DATE
  13. *      3-Sep-96
  14. *
  15. *    MODIFICATION HISTORY
  16. *
  17. ******************************************
  18. */
  19.  
  20. #include <BEAST:Include/proto/beast.h>
  21. #include <proto/exec.h>
  22. #include <utility/tagitem.h>
  23.  
  24. /**************************
  25.  **** structure definitions
  26.  ****/
  27. #define BFS_ToLowerCLASS_NAME "BFS_ToLowerClass" 
  28.  
  29. /***************************
  30.  **** The instance structure
  31.  ****/
  32. struct BFS_ToLowerInstance
  33. {
  34. #include "BFS_ToLowerClass.instance"
  35. };
  36.  
  37. extern struct Library *BeastBase, *SysBase;
  38. extern char             idString[], ClassName[];
  39.  
  40. #ifdef __SAS__
  41. ULONG __asm Init_Class(void);
  42. ULONG __asm Exit_Class(void);
  43. #else
  44. ULONG Init_Class(void);
  45. ULONG Exit_Class(void);
  46. #endif
  47.  
  48.     /**** These methods are defined as example... they are not needed ****/
  49. rfcall (mth_ContentsInput,  BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList);
  50.  
  51.     /**** The name of the library ****/
  52. char idString[]  = "BFS_ToLowerClass  ("__DATE__")\n\r\0";
  53.     /**** The name of the class as defined in my_class.h ****/
  54. char ClassName[] = BFS_ToLowerCLASS_NAME ;
  55.  
  56. struct BST_Class *BFS_ToLowerClass;
  57.  
  58.  long *enforce = 0x0000000;
  59.  
  60.  
  61. /****** BFS_ToLowerClass/Init_Class [1.0]
  62. *
  63. *    NAME
  64. *      Init_Class
  65. *
  66. **********************************
  67. */
  68. #ifdef __SAS__
  69. ULONG __asm Init_Class(void)
  70. #else
  71. ULONG Init_Class(void)
  72. #endif
  73. {
  74.   /*******************************************************************
  75.    **** Define class.... use BST_MakeSubClass if there is a superclass
  76.    ****/
  77.   if (BFS_ToLowerClass = BST_MakeSubClass( ClassName, sizeof(struct BFS_ToLowerInstance ), "BST_BaseClass" ))
  78.     {
  79.       CLSS_AddMethod( BFS_ToLowerClass, (ULONG *)&mth_ContentsInput,  OBM_CONTENTSINPUT  );
  80.       BST_AddClass(   BFS_ToLowerClass );
  81.     }
  82.  
  83.   return( 0 );
  84. }
  85.  
  86. /****** BFS_ToLowerClass/Exit_Class [1.0]
  87. *
  88. *    NAME
  89. *      Exit_Class
  90. *
  91. ***********************************
  92. */
  93. #ifdef __SAS__
  94. ULONG __asm Exit_Class(void)
  95. #else
  96. ULONG Exit_Class(void)
  97. #endif
  98. {
  99.   BST_RemoveClass( BFS_ToLowerClass );
  100.   BST_FreeClass(   BFS_ToLowerClass );
  101.   return( 0 );
  102. }
  103.  
  104.  
  105. /****** BFS_ToLowerClass/mth_ContentsInput [1.0]
  106. *
  107. *    NAME
  108. *      mth_ContentsInput
  109. *
  110. **************************************************
  111. */
  112. rfcall (mth_ContentsInput, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
  113. {
  114.  
  115.   struct TagItem *cur_ti;
  116.   
  117.   if (cur_ti = BST_FindTagItem( BTA_MemBlock, TagList ))
  118.     {
  119.       char *buffer = (char *)cur_ti->ti_Data;
  120.       if (cur_ti = BST_FindTagItem( BTA_MemSize, TagList ))
  121.         {
  122.           ULONG size = cur_ti->ti_Data;
  123.           
  124.           long counter;
  125.           char kar;
  126.           for( counter = 0; counter < size; counter++ )
  127.             {
  128.               kar = buffer[counter];
  129.               if ((kar>='A') && (kar<='Z')) kar -= 'A'-'a';
  130.               buffer[counter] = kar;
  131.             }
  132.         }
  133.     }
  134.  
  135.   OBJ_ToOutput( Object, TagList, OBM_CONTENTSOUTPUT, 0 );
  136.  
  137.   return MethodFlags;
  138. }
  139.  
  140.